﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _92类和对象问卷案例
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Question[] questions = GetQuestions();
            string[] userAnswers = new string[questions.Length];
            for (int i = 0; i < questions.Length; i++)
            {
                questions[i].Show();
                userAnswers[i] = Console.ReadLine();
            }
            //核对答案
            int score = 0;
            for (int i = 0; i < questions.Length; i++)
            {
                if (questions[i].CheckAnswer(userAnswers[i]))
                {
                    score++;
                }
            }
            Console.WriteLine("得分:" + score);
        }

        private static Question[] GetQuestions()
        {
            Question q1 = new Question()
            {
                title = "一下那个不是值类型?",
                options = new string[] {
                    "A.int",
                    "B.string",
                    "C.double",
                    "D.char"
                },
                trueAnswer = "B"
            };

            Question q2 = new Question()
            {
                title = "以下说法正确的是?",
                options = new string[] {
                    "A.参数修饰符ref和out没有区别",
                    "B.rer参数在传递前无须对变量赋值",
                    "C.out参数在方法返回前必须赋值",
                    "D.以上说法都不正确"
                },
                trueAnswer = "C"
            };

            Question q3 = new Question()
            {
                title = "关于数据长度一下那个错误?",
                options = new string[] {
                    "A.bool只长度为1字节",
                    "B.int长度为32位",
                    "C.byte长度位1字节",
                    "D.sizeof(double)结果为64"
                },
                trueAnswer = "D"
            };

            return new Question[] { q1, q2, q3 };
        }
    }
}